Skip to content

Conversation

coodos
Copy link
Contributor

@coodos coodos commented Aug 25, 2025

Description of change

Issue Number

Type of change

How the change has been tested

Change checklist

  • I have ensured that the CI Checks pass locally
  • I have removed any unnecessary logic
  • My code is well documented
  • I have signed my commits
  • My code follows the pattern of the application
  • I have self reviewed my code

Summary by CodeRabbit

  • New Features

    • View eVault logs and metrics directly from the Monitoring page.
    • Built‑in fallback ensures logs/metrics remain available even if the primary service isn’t loaded.
  • Improvements

    • Selection now uses stable IDs/names, staying consistent across filtered and paginated lists.
    • “Select all” respects current filters; selections persist more reliably between sessions.
    • Row-click navigation to details is more accurate.
  • Bug Fixes

    • Clear 404 errors when a namespace or pod doesn’t exist.
    • More informative error messages and improved resilience when fetching logs and metrics.

Copy link
Contributor

coderabbitai bot commented Aug 25, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Adds EVaultService methods for logs/metrics fetching, refactors selection in the main page from index- to id/name-based, enhances the logs API with namespace/pod existence checks and refined errors, and introduces a runtime polyfill on the monitoring page to ensure EVaultService methods exist.

Changes

Cohort / File(s) Summary
Service additions: EVault logs/metrics
infrastructure/control-panel/src/lib/services/evaultService.ts
Adds static methods: getEVaultLogs(namespace, podName) → fetches /api/evaults/{namespace}/{podName}/logs; getEVaultMetrics(namespace, podName) → fetches /metrics. Validates response.ok, parses JSON, returns logs[]/metrics{}, logs errors, rethrows. Duplicate JSDoc above getEVaultLogs.
Control panel selection refactor
infrastructure/control-panel/src/routes/+page.svelte
Converts selection from index-based (number[]) to identifier-based (string[]) for eVaults and platforms. Updates all handlers (single select, select-all, navigation) to resolve via paginatedEVaults()/filteredPlatforms() and persist resolved objects in sessionStorage.
Logs API validation and error handling
infrastructure/control-panel/src/routes/api/evaults/[namespace]/[pod]/logs/+server.ts
Adds pre-checks: validate namespace and pod via kubectl before fetching logs. Returns 404 for missing resources; otherwise fetches logs with container evault and tail parameter. Improves catch: 404 on not found; 500 otherwise. Keeps log processing.
Monitoring page EVaultService polyfill
infrastructure/control-panel/src/routes/monitoring/[namespace]/[service]/+page.svelte
Adds runtime checks for EVaultService methods. If absent, defines async fallbacks that call the corresponding API endpoints, returning logs[]/metrics{} and propagating errors. Includes console diagnostics.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    actor U as User
    participant M as Monitoring Page
    participant S as EVaultService<br/>(native or polyfill)
    participant API as /api/evaults/{ns}/{pod}/logs
    participant K as kubectl

    U->>M: Open monitoring view
    M->>S: getEVaultLogs(ns, pod)
    alt Native implementation
        S->>API: GET /logs
    else Polyfill
        S->>API: GET /logs
    end
    API->>K: kubectl get namespace {ns}
    alt Namespace missing
        API-->>S: 404 Namespace not found
        S-->>M: Throw error
        M-->>U: Show error
    else Namespace exists
        API->>K: kubectl get pod {pod} -n {ns}
        alt Pod missing
            API-->>S: 404 Pod not found
            S-->>M: Throw error
            M-->>U: Show error
        else Pod exists
            API->>K: kubectl logs -n {ns} {pod} -c evault --tail={tail}
            K-->>API: stdout (logs)
            API-->>S: 200 { logs: [...] }
            S-->>M: logs[]
            M-->>U: Render logs
        end
    end
Loading
sequenceDiagram
    autonumber
    actor U as User
    participant CP as Control Panel Page
    participant DS as Data Store<br/>(sessionStorage)

    U->>CP: Select eVaults/platforms
    CP->>CP: Map selection by evaultId/platform.name via filtered lists
    CP->>DS: Persist selected objects keyed by id/name
    U->>CP: Click "Go to Monitoring"
    CP->>CP: Reconstruct selections from ids/names
    CP-->>U: Navigate with resolved targets
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Poem

A hop, a skip, I sift the logs—
IDs, not indices, guide my jogs.
I nibble metrics, crunchy bytes,
Pods and namespaces in sights.
With whiskers twitching, checks in place,
I bound through dashboards—swift and ace. 🐇✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 9db3ccc and 872a227.

⛔ Files ignored due to path filters (2)
  • infrastructure/eid-wallet/src-tauri/gen/apple/eid-wallet.xcodeproj/project.pbxproj is excluded by !**/gen/**
  • infrastructure/eid-wallet/src-tauri/gen/apple/eid-wallet_iOS/Info.plist is excluded by !**/gen/**
📒 Files selected for processing (4)
  • infrastructure/control-panel/src/lib/services/evaultService.ts (1 hunks)
  • infrastructure/control-panel/src/routes/+page.svelte (8 hunks)
  • infrastructure/control-panel/src/routes/api/evaults/[namespace]/[pod]/logs/+server.ts (2 hunks)
  • infrastructure/control-panel/src/routes/monitoring/[namespace]/[service]/+page.svelte (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/control-panel-search

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coodos coodos merged commit eb2d6e5 into main Aug 25, 2025
0 of 4 checks passed
@coodos coodos deleted the fix/control-panel-search branch August 25, 2025 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant